#main7.py
#-*-coding:utf-8-*-
from BASECLASS import PYTHON_BAN
import sys
if PYTHON_BAN in (2,):
    #在py2下，这是为了处理中文乱码问题。py3下官方修复就不要这样处理了。
    reload(sys)
    sys.setdefaultencoding('utf-8')
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
import time,threading
from ui_widget import Ui_MainWindow
#from ui_mainwindow import Ui_MainWindow

class Dialog(QObject,Ui_MainWindow):
    SHOW_STATUS = pyqtSignal(str)
    def __init__(self):
        Ui_MainWindow.__init__(self)
        QObject.__init__(self)
        #如果是widget类型
        #self.widget=QWidget()
        #如果是mainwindow类型
        self.widget = QMainWindow()
        self.setupUi(self.widget)
        self.widget.show()
        self._band_()
    def _band_(self):
        self.runbutton.clicked.connect(self.runbutton_down)
        self.SHOW_STATUS.connect(self.show_status)
    def runbutton_down(self):
        t = threading.Thread(target=self.runbutton_down_runner)
        t.start()
    def runbutton_down_runner(self):
        self.SHOW_STATUS.emit(u'运行中')
        time.sleep(5)
        self.SHOW_STATUS.emit(u'完成')
    def show_status(self,message):
        self.labelstatus.setText(message)
        
if __name__ == '__main__':
    app=QApplication(sys.argv)  
    ui = Dialog()
    sys.exit(app.exec_())  